﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FileDFS.Model;

namespace FileDFS.Bll
{
    public class DeleteHandler
    {
        public static DeleteHandler GetInstance()
        {
            return new DeleteHandler();
        }
        /// <summary>
        /// 批量删除文件
        /// </summary>
        /// <param name="deleteList"></param>
        public bool DeleteFiles(List<DeleteModel> deleteList)
        {
            try
            {
                foreach (DeleteModel del in deleteList)
                {
                    DeleteQueueModel queModel = new DeleteQueueModel()
                    {
                        AbsoluteFullPath = Utils.PathConfig.CatalogHandler.GetInstance().GetDetailByVirtual(del.DeleteFullVirtualPath).Absolute_FullPath,
                        PhysicDelete = del.PhysicDelete
                    };
                    Utils.DeleteHelper.AddDelete(queModel);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
